<?php
/* *
* $Author ：PHPYUN开发团队
*
* 官网: http://www.phpyun.com
*
* 版权所有 2009-2019 宿迁鑫潮信息技术有限公司，并保留所有权利。
*
* 软件声明：未经授权前提下，不得用于商业运营、二次开发以及任何形式的再次发布。
*/
class chat_controller extends user
{
	function index_action(){
	    if ($this->config['sy_chat_open']==1){
	        
	        $this->public_action();
	        
	        $chatM  =  $this -> MODEL('chat');
	        
	        if (isset($_GET['id']) && isset($_GET['type']) && $this->uid && $this->usertype){
	            
	            $uid    =  intval($_GET['id']);
	            
	            $chat   =  $chatM->userinfo(array('uid'=>$uid,'usertype'=>intval($_GET['type']),'nowid'=>$this->uid,'nowtype'=>$this->usertype));
	            
	            $this -> yunset('receive',$chat['mine']);
	            
	            $chatM -> upChatLog(array('status'=>1),array('from'=>$uid,'to'=>$this->uid,'fusertype'=>$chat['mine']['usertype'],'tusertype'=>$this->usertype));
	            
	            $data['nickname']  =  $chat['mine']['username'];
	            
	            $this->data        =  $data;
	            
	            $this->seo('chat');
	            
	        }
	        
	        $myself   =  $chatM->userinfo(array('uid'=>$this->uid,'usertype'=>$this->usertype,'history'=>1));
	        
	        $this -> yunset('rows',$myself['history']);
	        
	        $this->yuntpl(array('chat/yunliao/index'));
	    }else{
	        
	        $this->ACT_msg('网站未开启'.$this->config['sy_chat_name'].'功能');
	    }
	}
}
?>